<div class="popup_body">
    <div class="ui_table">
        <form method="post">
            <input type="hidden" name="activeFlag" value="1" id="active_flag_${pid}">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td width="80" align="right">代理商名称：</td>
                    <td><input type="text"maxlength="20" class="text easyui-validatebox" name="agencyName" required="true"/></td>
                </tr>
                <#--新增：-->
                <tr>
                    <td align="right">负责人姓名：</td>
                    <td><input type="text" maxlength="20" class="text easyui-validatebox" name="principalName" required="true"/></td>
                </tr>

            <#if Session['SESSION_KEY_USER'].type == Session['USER_TYPE_PLATFORM'].value>
                <tr>
                    <td align="right">运营商：</td>
                    <td>
                        <input name="agentId" class="easyui-combotree" editable="false"
                               style="width: 182px; height: 28px;"
                               data-options="url:'${contextPath}/security/basic/agent/tree.htm',method:'get',required:true"/>
                    </td>
                </tr>
            <#elseif Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENCY'].value||Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENT'].value>
                <input type="hidden" name="agentId" value="${Session['SESSION_KEY_USER'].agentId}"></#if>
                <tr>
                    <td width="80" align="right">联系电话：</td>
                    <td><input type="text" class="text easyui-validatebox" name="tel"maxlength="17" required="true"/></td>
                </tr>
                <#--新增：-->
                <tr>
                    <td align="right">详细地址：</td>
                    <td><input type="text" class="text easyui-validatebox" name="detailAddress" maxlength="17"/></td>
                </tr>
                <tr>
                    <td align="right">备注：</td>
                    <td><textarea name="memo" maxlength="20"></textarea></td>
                </tr>
                <tr>
                    <td align="right">是否启用：</td>
                    <td><input type="checkbox" class="checkbox" name="activeFlag" checked value="1"
                               onclick="$('#active_flag_${pid}').val(this.checked ? 1 : 0)"></td>
                </tr>
            </table>
        </form>
    </div>
</div>
<div class="popup_btn">
    <button class="btn btn_red ok">确定</button>
    <button class="btn btn_border close">关闭</button>
</div>
<script>
    (function () {
        var pid = '${pid}',
                win = $('#' + pid),
                form = win.find('form');

        win.find('button.ok').click(function () {
            form.form('submit', {
                url: '${contextPath}/security/hdw/agency/create.htm',
                success: function (text) {
                    var json = $.evalJSON(text);
                <@app.json_jump/>
                    if (json.success) {
                        $.messager.alert('提示信息', '操作成功', 'info');
                        win.window('close');
                    } else {
                        $.messager.alert('提示信息', json.message, 'info');
                    }
                }
            });
        });
        win.find('button.close').click(function () {
            win.window('close');
        });

    })()
</script>
